import api from '../../api/index'
Page({
  data: {
    mine: {
      lastScore: 19,
      bestScore: 65,
      rank: 8
    },
    rank: [
      { avatar: 'http://www.chunling.online/img/logo.6ab7712b.jpg', nickname: '清湖', score: 15 },
      { avatar: 'http://www.chunling.online/img/logo.6ab7712b.jpg', nickname: '青岛', score: 15 },
    ]
  },
  onShareAppMessage() {
    return {
      title: '脑力颜色大作战，颜色辨认在线PK',
      path: '/pages/color/color'
    }
  },
  getUserInfo(e) {
    if (e.detail.errMsg === 'getUserInfo:ok') {
      let nickName = e.detail.userInfo.nickName
      console.log(e.detail)
      wx.setStorageSync('nickName', nickName)
      wx.setStorageSync('userInfo', e.detail.userInfo)
      this.showIptPanelFn()
      // wx.navigateTo({url: '/pages/undercover/undercover'})
    }
  },
  onLoad() {
    let openid = wx.getStorageSync('openid')
    if (openid) { 

    } else {
      wx.login({
        success(res) {
          if (res.code) {
            console.log(res.code)
          } else {
            console.log('登录失败！' + res.errMsg)
          }
        }
      })
    }
  }
})